package com.bush.mall.member.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.member.entity.MemberCollectSpuEntity;
import com.bush.mall.member.service.MemberCollectSpuService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 会员收藏的商品
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("membercollectspu")
@Api(tags = "会员收藏的商品管理" )
public class MemberCollectSpuController {

    @Resource(name= MemberCollectSpuService.BEAN_ID)
    private MemberCollectSpuService memberCollectSpuService;

    /**
     * 分页查询会员收藏的商品列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询会员收藏的商品列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return memberCollectSpuService.queryForPage(current,size);
    }

    /**
     * 保存会员收藏的商品表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存会员收藏的商品表单")
    @PostMapping
    public Result saveMemberCollectSpu(@RequestBody MemberCollectSpuEntity memberCollectSpu){
        return memberCollectSpuService.saveMemberCollectSpu(memberCollectSpu);
    }

    /**
     * 修改会员收藏的商品表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改会员收藏的商品表单")
    @PutMapping
    public Result updateMemberCollectSpu(@RequestBody MemberCollectSpuEntity memberCollectSpu){
        return memberCollectSpuService.updateMemberCollectSpu(memberCollectSpu);
    }

    /**
     * 通过指定id删除会员收藏的商品
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除会员收藏的商品")
    @DeleteMapping
    public Result deleteMemberCollectSpu(Long id){
        return memberCollectSpuService.deleteMemberCollectSpu(id);
    }

}
